const request = require('./request')

const BASE_URL = '/integral'

/**
 * 签到提交
 * @param {*} param 
 */
function signIn(param) {
  // 这里用POST方式，参数放body
  return request.post(BASE_URL + '/sign-in', {});
}

/**
 * 获取积分分页历史
 * @param {*} current 
 * @param {*} size 
 * @returns 
 */
function getIntegralRecordPage(current = 1, size = 10) {
  return request.get(BASE_URL + '/record/page/list', { 
    current, size 
  });
};

/**
 * 获取所有签到记录
 * @param {*} current 
 * @param {*} size 
 * @returns 
 */
function getAllSign() {
  return request.get(BASE_URL + '/sign-in/all');
};

/**
 * 获取积分统计值
 * @returns 
 */
function getSummary(shouldShowLoading = true) {
  return request.get(BASE_URL + '/summary', {}, {}, shouldShowLoading);
};

/**
 * 获取积分规则
 * @returns 
 */
function getRules() {
  return request.get(BASE_URL + '/rules', {}, {}, true);
};


module.exports = {
  signIn,
  getIntegralRecordPage,
  getAllSign,
  getSummary,
  getRules
} 